import { BasicFetchResult, BasicPageParams, SaaSPageParams } from '../../model/baseModel';

export type SaaSUserRole = {
  roleId: string;
  roleName: string;
};

export type SaaSUserRoleQuery = {
  id: string;
  name: string;
};

export type SaaSUserParams = {
  userName: string;
  orgId: string;
};
export type SaaSUserPasswordParams = {
  userId: string;
  password: string;
  repeatPassword: string;
};
export type SaaSUserPageParams = { model: SaaSUserParams } & SaaSPageParams;

export interface SaaSUserRoleItem {
  roleId: string;
  roleName: string;
}

export interface SaaSSubAppItem {
  id: string;
  name: string;
}

export interface SaaSRoleItem {
  name: string;
  id: string;
}

export interface SaaSUserRoleDto {
  id: string;
  name: string;
}

export interface SaaSUserListItem {
  // [x: string]: number;
  // [x: string]: number;
  total: number;
  items: any;
  id: string;
  idaasUserId: string;
  userName: string;
  name: string;
  email: string;
  status: number;
  phone: string;
  orgId: string;
  orgName: string;
  tenantCode: string;
  tenantName: string;
  createdTime: string;
  roles: SaaSUserRoleDto[];
}

export interface SaaSAuthListItem {
  name: string;
  idaasAppId: string;
  type: string;
  appId: string;
  roleName: string;
  roleCode: string;
}

export type SaaSUserRoleParams = {
  // eslint-disable-next-line camelcase
  user_id: string;
};

export type UserParams = BasicPageParams & {
  userName?: string;
  orgId?: string;
};

export interface UserListItem {
  userId: string;
  userName: string;
  realName: string;
  email: string;
  phone: string;
  orgId: string;
  orgName: string;
  roleNames: string[];
  roleCodes: string[];
  status: string;
  createTime: string;
}

export type UserInfo = {
  userId?: string;
  userName: string;
  realName?: string;
  phone: string;
  email?: string;
  orgId: string;
  roleCodes: string[];
  status: string;
};

export type OrgParams = {
  orgName?: string;
};

export interface OrgListItem {
  orgId: string;
  orgName: string;
  orgCode: string;
  description: string;
  createTime: string;
  children: OrgListItem[];
}

export interface RoleListItem {
  roleId: string;
  roleCode: string;
  roleName: string;
  description: string;
  status: string;
  createTime: string;
}

export interface App {
  appId: string;
  effectiveTime: string;
  expireTime: string;
  name: string;
  idaasAppId: string;
  onlineNum: number;
  packageType: string;
  subAppId: string;
  logo: string;
  logoPath?: string;
  versionPath?: string;
}

export type UserListGetResultModel = BasicFetchResult<UserListItem>;

export type OrgListGetResultModel = BasicFetchResult<OrgListItem>;

export type RoleListGetResultModel = BasicFetchResult<RoleListItem>;
